package d5_TCP2;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws IOException {
        System.out.println("Server started......");
        ServerSocket serverSocket = new ServerSocket(4865);

        while (true) {
            Socket socket = serverSocket.accept();//接口接受连接
            System.out.println(socket.getRemoteSocketAddress()+"Client connected");
            //创建独立的线程来接收消息
            ServerReaderThread srt = new ServerReaderThread(socket);
            srt.start();
        }
    }
}
